<template>
  <div ref="DoughNut" class="DoughNut">DoughNut</div>
</template>

<script>
import * as echarts from 'echarts/core'
import { PieChart } from 'echarts/charts'
import { LabelLayout } from 'echarts/features'
import { CanvasRenderer } from 'echarts/renderers'

echarts.use([PieChart, CanvasRenderer, LabelLayout])
export default {
  mounted() {
    var chartDom = this.$refs.DoughNut
    var myChart = echarts.init(chartDom)
    var option

    option = {
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: ['40%', '70%'],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 10,
            borderColor: '#fff',
            borderWidth: 2
          },
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '10',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            { value: 1048, name: '公寓' },
            { value: 735, name: '别墅' },
            { value: 580, name: '商品房' },
            { value: 484, name: '写字楼' },
            { value: 300, name: '二手房' }
          ]
        }
      ]
    }

    option && myChart.setOption(option)
  }
}
</script>

<style lang="scss" scoped>
::v-deep canvas{
    // width: 100px;
    // height: 100px;
    top: -65px !important;
    left: 45px !important
}
.DoughNut{
    height:150px;
    // position: absolute;
    // top: 60px;
}
</style>
